# Makefile for AVRmp3 E6Mic projekt
# Lavet af Michael Torp Kaalund (05576)
CC=avr-gcc
OBJCOPY=avr-objcopy
PROG=avrdude
PORT=/dev/ttyUSB0
PART=m16
ID=stk500v2
CFLAGS=-g -mmcu=atmega16 -Wall
INC=-I./
PROJECT=avrmp3
SOURCES=main.c usart.c cache.c #vs1001k.c spi.c

rom.hex : $(PROJECT).out
	$(OBJCOPY) -j .text -O ihex $(PROJECT).out rom.hex

$(PROJECT).out : $(SOURCES)
	$(CC) $(CFLAGS) $(INC) -o $(PROJECT).out $(SOURCES)

$(PROJECT).o : $(SOURCES)
	$(CC) $(CFLAGS) -Os -c $(SOURCES)
install: 
	$(PROG) -p $(PART) -c $(ID) -P $(PORT) -U flash:w:rom.hex	

clean:
	rm -f *.o *.out *.map *.hex


